<template>
  <div>
    
    <h2>数据表</h2>
    <el-table
    :data="data"
    style="width: 100%"
    
  >
    <el-table-column prop="Time" label="时间" width="271" />
    <el-table-column prop="SalesVolume" label="销售额（万元）" width="271" />
    <el-table-column prop="SalesOrderQuantity" label="销售单量" width="271" />
    <el-table-column prop="Target" label="目标" width="271" />
    <el-table-column prop="CompletionRate" label="完成率" width="271" />
    <el-table-column prop="CollectionAmount" label="回款金额(万元)" />
  </el-table>
  <el-pagination
      :page-sizes="[10, 20, 30, 100]"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      :current-page="page"
      @current-change="changePage"
    />
</div>
</template>
<script setup lang = "ts">
import { useRoute } from 'vue-router'
import { useRouter } from 'vue-router'


interface IProps {
  page:number
  total: number
  data:DataModule.DataInfo[]
  loadData:(page:number)=>void
}



const route = useRoute()
const router = useRouter()
const props = defineProps<IProps>()
const btns = ()=>{  
  console.log(props.data);
}


// 分页
const changePage = (page: number) => {
  console.log(111);
  props.loadData(page)
  const query = { ...route.query, page }
  router.replace({ query })
}


</script>
<style lang= "scss" scoped>
.el-table .warning-row {
  --el-table-tr-bg-color: var(--el-color-warning-light-9);
}
.el-table .success-row {
  --el-table-tr-bg-color: var(--el-color-success-light-9);
}
</style>